﻿using CSharpDesign.DAL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace CSharpDesign.BLL
{
    public class MyOrderService
    {
        public static void gvInfo_RowDataBounds(GridViewRowEventArgs e)
        {
            //鼠标移动变色
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //当鼠标放上去的时候 先保存当前行的背景颜色 并给附一颜色 
                e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#f6f6f6',this.style.fontWeight='';");
                //当鼠标离开的时候 将背景颜色还原的以前的颜色 
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");
            }
            //单击行改变行背景颜色 
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onclick", "this.style.backgroundColor='#f6f6f6'; this.style.color='buttontext';this.style.cursor='default';");
            }
        }
        public static SqlConnection GetCode(int iCount, out SqlConnection con, out SqlDataAdapter da, out DataSet ds, string username)
        {
            SqlHelper date = new SqlHelper();
            string strTop = "";
            if (iCount > 1)
            {
                strTop = "top " + iCount.ToString();

            }

            string sql = "select  " + strTop + "  * from [GouWuChe] where Ordeuser='" + username + "' and OrderStite='已完成'   ";
            con = new SqlConnection(SqlHelper.connstring);
            SqlCommand cmd = new SqlCommand(sql, con);

            da = new SqlDataAdapter(cmd);
            ds = null;
            con.Open();
            ds = new DataSet();
            da.Fill(ds);
            return con;
        }
    }
}